//#pragma once
#ifndef __CHANNELFORMIXER_H__
#define __CHANNELFORMIXER_H__

#include "StreamForChannel.h"

enum CHANNEL_TYPE{
		NORMAL_IN=0,
		NORMAL_OUT,
		HOST_IN,
		HOST_OUT,
	};

class CChannelForMixer;

typedef void (__stdcall *ChannelDataCallBackProc) (float* lChnl,float* rChnl,int nSamples,CChannelForMixer* obj,void* context);

class CChannelForMixer
{
protected:
	
public:
	CChannelForMixer(void);
	~CChannelForMixer(void);
	int ProcessData(float* pLChnl, float* pRChnl, int nSamples);
	bool BindStream(CStreamForChannel* pStream);//Once bond, No detechment.
	CStreamForChannel* GetBindedStream(void);
	float SetVolume(float vol);
	float GetVolume(void);
	float SetPan(float PanPercents);
	float GetPan();
	float SetPosition(float PosFromLeftToRight);
	float GetPosition(void);
	void SetMute(bool fEnabled);
	bool GetMute(void);
	void SetInvert(bool fEnabled);
	bool GetInvert(void);
	bool SetRawDataProcess(ChannelDataCallBackProc CallBackFun,void* context);
	bool SetDataProcess(ChannelDataCallBackProc CallBackFun,void* context);
	CHANNEL_TYPE type;
	volatile bool IsPassBy;//Only For Server
protected:
	CStreamForChannel* pS;
	volatile float Volume;
	volatile float Pan;
	volatile float Position;
	volatile bool Mute;
	volatile bool Invert;
	ChannelDataCallBackProc PreProc;
	ChannelDataCallBackProc Proc;
	void* PreCtx;
	void* Ctx;
};

#endif